// Wait for PhoneGap to load
//
function onLoad() {
	console.log("loooad");
	document.addEventListener("deviceready", onDeviceReady, false);
}

// PhoneGap is ready
//
function onDeviceReady() {
	
	console.log(phoneName);
}

function test(){
	var element = document.getElementById('deviceProperties');
	element.innerHTML = 'Device Name: '     + device.name     + '<br />' + 
	'Device PhoneGap: ' + device.phonegap + '<br />' + 
	'Device Platform: ' + device.platform + '<br />' + 
	'Device UUID: '     + device.uuid     + '<br />' + 
	'Device Version: '  + device.version  + '<br />';
}

function test1(){
	var reader = new FileReader();
	reader.onload = function(e){
		alert([result, e]);
		var paths = navigator.fileMgr.getRootPaths();
		for(var i in paths)trace(paths[i] );

	};
	reader.onloadstart = function(e){
	}
			
	
	var paths = navigator.fileMgr.getRootPaths();
	reader.readAsText("reader_json.xml");

	/*
	try{
	var paths = navigator.fileMgr.getRootPaths();
	var reader = new FileReader();
	reader.onload = function(e){
		alert(e);
	};
	reader.onerror=  = function(e){
		alert(e);
	};
	
	reader.readAsDataURL(paths[0] + "reader_json.xml");
	
	trace("Hello"+paths[0]);
	}catch(e){
		alert(e);
	}&*/
	/*try{
	 var paths = navigator.fileMgr.getRootPaths();
	 alert(paths);
	 var reader = new FileReader();
	 reader.onload = function(e){
	 alert(e);
	 };
	 reader.onerror=  = function(e){
	 alert(e);
	 };
	 
	 reader.readAsDataURL(paths[0] + "readme.txt");
	 }catch(e){
	 alert("Fail->"+e);
	 }*/
}

function trace(msg){
	var tracer = document.getElementById('tracer');
	tracer.innerHTML += msg    + '<br />';
}
